package com.mobiporter.adias.tags;

import java.util.HashMap;
import java.util.Map;
import javax.servlet.jsp.JspException;

import com.mobiporter.adias.constants.RequestScopeObjects;

public class Header extends MobiTag
{
	private static final long serialVersionUID = -3052938036318117455L;
	
	public Header()
	{
		super() ;
	}
	

	public void setValueToControl(String value) {	}

	
	public int doEndTag() throws JspException 
	{
		return EVAL_PAGE ;
	}

	@SuppressWarnings("unchecked")
	@Override
	public int doStartTag() throws JspException 
	{
		/* Push the request parameters to the RequestMap */
		HashMap<String, String> realParams = new HashMap<String, String>() ;
		Map<String,String[]> parameters = pageContext.getRequest().getParameterMap() ;
		for (Map.Entry<String, String[]> entry : parameters.entrySet())
		{
			realParams.put(entry.getKey(), entry.getValue()[0]);
		}
		if (realParams.size()==0)
			realParams = null ;
		pageContext.setAttribute(RequestScopeObjects.PARAMETER_MAP, realParams);
		
		
		return SKIP_BODY ;
		
		
	}

}
